# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pygtksourceview

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}2"
pkgver=2.10.1
pkgrel=1
pkgdesc="Python bindings for gtksourceview2 (mingw-w64)"
arch=(any)
url="http://www.gnome.org"
license=('LGPL')
groups=("${MINGW_PACKAGE_PREFIX}")
depends=("${MINGW_PACKAGE_PREFIX}-gtksourceview2>=2.10.0"
      "${MINGW_PACKAGE_PREFIX}-python2-pygtk>=2.17.0")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-gobject2"
      "intltool")
options=('staticlibs' 'strip')
source=(http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver%.*}/${_realname}-${pkgver}.tar.bz2
    python-m4.patch)
md5sums=('2654354d61422fb79d8375fc3a3b5393'
         'bc368c2b741d2b3b8612b882378bbba6')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  #patch -p1 -i ${srcdir}/python27.patch
  #patch -p1 -i ${srcdir}/no-undefined.patch
  patch -p1 -i ${srcdir}/python-m4.patch
  autoreconf -fi
  #WANT_AUTOMAKE=latest ./autogen.sh
}

build() {
  cd "$srcdir"

  rm -rf python2-build
  mkdir python2-build
  #cp -r ${_realname}-$pkgver $builddir
  pushd python2-build
    export lt_cv_deplibs_check_method='pass_all'
    PYTHON=${MINGW_PREFIX}/bin/python2 \
    ../${_realname}-$pkgver/configure --prefix=${MINGW_PREFIX} \
      --build=${MINGW_CHOST} \
      --host=${MINGW_CHOST} \
      --target=${MINGW_CHOST} \
      --disable-static --disable-docs
    make VERBOSE=1
  popd
}

package() {
  cd python2-build
  make DESTDIR="$pkgdir" install
}
